package cn.fjy.android.utils;

import android.media.MediaPlayer;
import android.util.Log;

/**
 *@author GrayF
 *2011-8-18
 *@version 1.0
 */
public class MusicPlayer {
	private final static String tag = "MusicPlayer";
	
	private MediaPlayer player;
	
	public void play(String filePath){
		player = new MediaPlayer();
		try {
			Log.d(tag,"开始播放录音");
			player.setDataSource(filePath);
			player.prepare();
			player.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
	public void stop(){
		if(player!=null&&player.isPlaying()){
			player.stop();
			player.reset();
			player.release();
		}
	}
}

